var showDrvInfo;
require([], function () {
    var $formData = $('#formData');
    
    function driverChange(event, treeId, treeNode) {
        if (treeNode.type === 'DRIVER') {
            searchDrvInfo(treeNode.id);
        } else {
            $.messager.alert("提示", "请选择驾驶员进行查看。");
        }
    }

    //左侧树
    commonFun.leftTreeNodeClickObj['drvAnaDriverInfo'] = driverChange;

    function searchDrvInfo(drvId) {
        $.ajaxExt({
            url: "/drvAna/getDrvInfo.htm",
            data: {'drvId': drvId}
        }).done(function (data) {
            $('.img-box img').attr("src","");
            console.info(data);
            if(typeof (data[0].drvHeadPath != 'undefined') ){
                console.info(data[0].drvHeadPath);
                $('.img-box img').attr("src",$.getProjectName() + "/baseBlackArchivesInfo/readImage.htm?uploadPath=" + data[0].drvHeadPath);
            }
            data && $formData.setViewData(data[0]);
        });
    }
    
    showDrvInfo = function(data){
    	searchDrvInfo(data.drvId)
    }

    //如果左侧树有选择驾驶员则直接查询该驾驶员数据
    business.execFnByLeftTreeSelectNode('DRIVER', driverChange);
});